package com.example.powernodemall.Exception;

import com.example.powernodemall.ProjectEnum.ResultEnum;
import com.example.powernodemall.model.Result;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

@RestControllerAdvice
public class GlobalExceptionHandler {
    @ExceptionHandler(value = ProjectException.class)
    public Result<Object> handleProjectException(ProjectException e) {
        return Result.Failure(ResultEnum.PROHIBIT_LOGiN, e.getMessage());
    }
    @ExceptionHandler(value = Exception.class)
    public Result<Object> exception(Exception e) {
        return Result.Failure(ResultEnum.PROHIBIT_LOGiN,e.getMessage());
    }
}
